package com.tianhua.javs.core.engine.filter;

import com.tianhua.javs.client.bean.JavsTranslateContextBean;
import com.tianhua.javs.core.engine.TranslateFilter;
import com.tianhua.javs.core.constant.TagConstants;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * Description:java原生语句过滤处理
 * date: 2022/2/11
 *
 * @author shenshuai
 * @version 1.0.0
 * @since JDK 1.8
 */
@Component(value = "originSourceFilter")
public class OriginSourceFilter implements TranslateFilter {
    @Resource(name = "assignFilter")
    private TranslateFilter assignFilter;

    @Override
    public String filter(JavsTranslateContextBean translateContextBean, String javsShell) {
        if(javsShell.endsWith(TagConstants.ROW_END)){
            //如果是原生的则不做解析
            return javsShell;
        }else {
            //进入赋值语句过滤
            return assignFilter.filter(translateContextBean, javsShell);
        }
    }
}
